package com.gsafety.proxy;

public class ProxyTarget implements Target{

    private  RealTarget realTarget;
    @Override
    public void myRequest() {
        this.beforeRequest();
        if (null == realTarget) {
            realTarget  = new RealTarget();
        }
        realTarget.myRequest();

        this.afterRequest();
    }

    private void beforeRequest() {
        System.out.println("Before Request");
    }

    private void afterRequest() {
        System.out.println("After Request");
    }
}
